//
//  YZMStockRealModel.m
//  YZMicroStock
//
//  Created by wangminhong on 16/4/7.
//  Copyright © 2016年 cqjr. All rights reserved.
//

#import "YZMStockRealModel.h"
#import "Mantle+Utils.h"
#import "NSNumber+Utils.h"

@implementation YZMStockRealModel

+ (NSDictionary *)JSONKeyPathsByPropertyKey {
    return @{
             @"time": @"time",
             @"code": @"stockLabel",
             @"name": @"stockName",
             @"lastClosePrice": @"lastClosePrice",
             @"openPrice": @"openPrice",
             @"highPrice" : @"highPrice",
             @"lowPrice" : @"lowPrice",
             @"price" : @"newPrice",
             @"todayDealNum" : @"todayDealNum",
             @"todayDealPrice" : @"todayDealPrice",
             @"buyPrices" : @"buyPrice",
             @"buyCounts" : @"buyNum",
             @"sellPrices" : @"sellPrice",
             @"sellCounts" : @"sellNum",
             @"amplitude" : @"amplitude",
             @"limitDownPrice" : @"limitDownPrice",
             @"limitUpPrice" : @"limitUpPrice",
             };
}

/*
 SH600004 =         {
 allDealNum = 1975;
 indexFutureOpenNum = 0;
 indexFuturePrice = 3304;
 presentDealNum = 1;
 };
 */

+ (NSValueTransformer *)timeJSONTransformer{
    
    return [NSValueTransformer valueTransformerForName:MTLDoubleDateTransformerName];
}

+ (NSValueTransformer *)todayDealNumJSONTransformer
{
    return [NSValueTransformer valueTransformerForName: MTLStringLongTransformerName];
}

+ (NSValueTransformer *)todayDealPriceJSONTransformer
{
    return [NSValueTransformer valueTransformerForName: MTLStringLongTransformerName];
}

+ (NSValueTransformer *)limitDownPriceJSONTransformer
{
    return [NSValueTransformer valueTransformerForName: MTLStringDoubleTransformerName];
}

+ (NSValueTransformer *)limitUpPriceJSONTransformer
{
    return [NSValueTransformer valueTransformerForName: MTLStringDoubleTransformerName];
}

- (BOOL)isSuspended{
    
    if ([@(self.price) isEqualWithDouble:0.0]) {
        
        return YES;
    }
    
    return NO;
}

- (void)setNilValueForKey:(NSString *)key{
    
}

@end
